/**
 * 
 */
package org.cuatrovientos.erp.business;

import java.util.List;

import org.apache.log4j.Logger;
import org.cuatrovientos.erp.dao.RegisterDAOInterface;
import org.cuatrovientos.erp.model.Register;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author eneko_lana
 * This class implements RegisterBOInterface
 */
public class RegisterBO implements RegisterBOInterface{
	// Get log4j logger
		private static final Logger logger = Logger.getLogger(RegisterBO.class);
		
		@Autowired
	    private RegisterDAOInterface RegisterDAO;
		
	/**
	 * @param int id
	 * @return Register Register
	 * This method returns a Register selected by it's id
	 */
	@Override
	public Register selectById(int id) {
		logger.info("selectById: " + id);
		return RegisterDAO.selectById(id);
	}
	
	/**
	 * @return All the countries we have in the database
	 */
	@Override
	public List<Register> selectAll() {
		logger.info("selectAll: ");
		return RegisterDAO.selectAll();
	}
	
	/**
	 * @return The number of countries we have in the database
	 */
	@Override
	public List<Register> search(String name) {
		logger.info("search : " + name);
		return RegisterDAO.search(name);
	}
	
	/**
	 * @param int id
	 * This method deletes the Register selected by id
	 */
	@Override
	public void deleteById(int id) {
		logger.info("delete by: " + id + " id");
		RegisterDAO.deleteById(id);
	}
	
	/**
	 * @param Register Register
	 * This method insert a Register in the database passed by parameter
	 */
	@Override
	public void insert(Register Register) {
		logger.info("insert: " + Register);
		RegisterDAO.insert(Register);
	}
	
	/**
	 * @param Register Register
	 * This method updates a Register passed by parameter
	 */
	@Override
	public void update(Register Register) {
		logger.info("update: " + Register);
		RegisterDAO.update(Register);
	}
	
	/**
	 * @param Register role
	 * This method deletes a Register passed by parameter
	 */
	@Override
	public void delete(Register Register) {
		logger.info("delete: " + Register);
		RegisterDAO.delete(Register);
	}

}
